﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Tradex.Messaging {

    /// <summary>
    /// This class ia a generic message for the Tradex Messaging System.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    [Serializable ()]
    public class Message<T> : Message {

        /// <summary>
        /// Constructor for a message, taking the content payload as parameter.
        /// </summary>
        /// <param name="content"></param>
        public Message(T content) {
            Content = content;
        }

        /// <summary>
        /// This is the content container of the message. It's type is determined by the generic parameter.
        /// </summary>
        public T Content { get; private set; }

        /// <inheritdoc />
        public override string ToString() {
            if (Content == null) {
                return base.ToString();
            }
            return Content.ToString();
        }

    }

}
